load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "jobs",
    srcs = [
        "adopt.go",
        "config.go",
        "errors.go",
        "execution_detail_utils.go",
        "executor_impl.go",
        "helpers.go",
        "job_info_storage.go",
        "job_info_utils.go",
        "job_scheduler.go",
        "jobs.go",
        "metrics.go",
        "progress.go",
        "registry.go",
        "resultcols.go",
        "retired.go",
        "schedule_metrics.go",
        "scheduled_job.go",
        "scheduled_job_executor.go",
        "structured_log.go",
        "test_helpers.go",
        "testing_knobs.go",
        "update.go",
        "utils.go",
        "validate.go",
        "wait.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/jobs",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/build",
        "//pkg/clusterversion",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobsprofiler/profilerconstants",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/multitenant",
        "//pkg/roachpb",
        "//pkg/scheduledjobs",
        "//pkg/security/username",
        "//pkg/server/telemetry",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/isql",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/protoreflect",
        "//pkg/sql/sem/builtins",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/types",
        "//pkg/util",
        "//pkg/util/envutil",
        "//pkg/util/hlc",
        "//pkg/util/json",
        "//pkg/util/log",
        "//pkg/util/log/eventpb",
        "//pkg/util/log/severity",
        "//pkg/util/metric",
        "//pkg/util/pprofutil",
        "//pkg/util/protoutil",
        "//pkg/util/retry",
        "//pkg/util/startup",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_errors//oserror",
        "@com_github_cockroachdb_logtags//:logtags",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_gogo_protobuf//jsonpb",
        "@com_github_gogo_protobuf//proto",
        "@com_github_gogo_protobuf//types",
        "@com_github_klauspost_compress//gzip",
        "@com_github_prometheus_client_model//go",
        "@com_github_robfig_cron_v3//:cron",
        "@io_opentelemetry_go_otel//attribute",
    ],
)

go_test(
    name = "jobs_test",
    size = "large",
    srcs = [
        "delegate_control_test.go",
        "execution_detail_utils_test.go",
        "executor_impl_test.go",
        "helpers_test.go",
        "job_info_storage_test.go",
        "job_info_utils_test.go",
        "job_scheduler_test.go",
        "jobs_test.go",
        "lease_test.go",
        "main_test.go",
        "progress_test.go",
        "registry_external_test.go",
        "registry_test.go",
        "scheduled_job_executor_test.go",
        "scheduled_job_test.go",
        "testutils_test.go",
        "update_test.go",
    ],
    embed = [":jobs"],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "heavy"},
        "//conditions:default": {"test.Pool": "default"},
    }),
    shard_count = 16,
    deps = [
        "//pkg/base",
        "//pkg/ccl/backupccl",
        "//pkg/cloud/impl:cloudimpl",
        "//pkg/clusterversion",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobsprotectedts",
        "//pkg/jobs/jobstest",
        "//pkg/keys",
        "//pkg/keyvisualizer",
        "//pkg/kv",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/protectedts/ptpb",
        "//pkg/roachpb",
        "//pkg/scheduledjobs",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/lease",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/sql/isql",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqlliveness/slstorage",
        "//pkg/testutils",
        "//pkg/testutils/jobutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/upgrade/upgradebase",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/log/eventpb",
        "//pkg/util/log/logpb",
        "//pkg/util/log/logtestutils",
        "//pkg/util/metric",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_gogo_protobuf//types",
        "@com_github_google_go_cmp//cmp",
        "@com_github_kr_pretty//:pretty",
        "@com_github_prometheus_client_model//go",
        "@com_github_robfig_cron_v3//:cron",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
